package com.model.base;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

@AllArgsConstructor
@NoArgsConstructor
@Builder
public class PageResult<T> {
    @JsonIgnore
    private PageInfo pageInfo;

    private T result;

    public void setResult(T result) {
        this.result = result;
    }


    @ApiModelProperty(value = "集合信息",required = true)
    public T getResult() {
        return result;
    }

    @ApiModelProperty(value = "当前页码",required = true)
    public int getPage(){
        return this.pageInfo.getPageNum();
    }

    @ApiModelProperty(value = "每页行数",required = true)
    public int getPageSize(){
        return this.pageInfo.getPageSize();
    }

    @ApiModelProperty(value = "记录总数",required = true)
    public long getTotal(){
        return this.pageInfo.getTotal();
    }

    @ApiModelProperty(value = "页数总计",required = true)
    public int getPageCount(){
        return this.pageInfo.getPages();
    }
    public void setPageInfo(PageInfo pageInfo) {
        this.pageInfo = pageInfo;
    }


}